package cn.percent.mvcframework.pojo;

import java.lang.reflect.Method;
import java.util.*;
import java.util.regex.Pattern;

public class Handler {
    private Object controller; // method.invoke
    private Method method;
    private Pattern pattern;  // spring中的url是支持正则
    private Map<String,Integer> paramIndexMapping;  // 参数顺序 为了参数绑定，key是参数名，value是第几个参数
    private Set<String> authority; // 权限列表

    public Handler(Object controller, Method method, Pattern pattern) {
        this.controller = controller;
        this.method = method;
        this.pattern = pattern;
        this.paramIndexMapping = new HashMap<>();
        this.authority = new HashSet<String>();
        //this.authority = new
    }

    public Object getController() {
        return controller;
    }

    public void setController(Object controller) {
        this.controller = controller;
    }

    public Method getMethod() {
        return method;
    }

    public void setMethod(Method method) {
        this.method = method;
    }

    public Pattern getPattern() {
        return pattern;
    }

    public void setPattern(Pattern pattern) {
        this.pattern = pattern;
    }

    public Map<String, Integer> getParamIndexMapping() {
        return paramIndexMapping;
    }

    public void setParamIndexMapping(Map<String, Integer> paramIndexMapping) {
        this.paramIndexMapping = paramIndexMapping;
    }

    public Set<String> getAuthority() {
        return authority;
    }

    public void setAuthority(Set<String> authority) {
        this.authority = authority;
    }
}
